package top.yoahh.system.service.impl;

import top.yoahh.system.entity.SysRoleMenu;
import top.yoahh.system.mapper.SysRoleMenuMapper;
import top.yoahh.system.service.SysRoleMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import top.yoahh.common.Result;
import top.yoahh.system.query.SysRoleMenuQueryInfo;
import java.util.List;

/**
 * <p>
 * 系统管理- 角色-权限资源关联表  服务实现类
 * </p>
 *
 * @author hjx
 * @since 2022-06-17
 */
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService {

    @Override
    public PageInfo<SysRoleMenu> queryPage(SysRoleMenuQueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPageNum(),queryInfo.getPageSize());
        List<SysRoleMenu> userList = baseMapper.queryList(queryInfo);
        return new PageInfo<>(userList);
    }

    @Override
    public Result deleteBatch(List<String> ids) {
        baseMapper.deleteBatchIds(ids);
        return Result.ok();
    }

    @Override
    public Result delete(String id) {
        baseMapper.deleteById(id);
        return Result.ok();
    }
}
